function getUrlParms(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return r[2]; return null;
}

var nameOne = getUrlParms("productid");

let productid = decodeURI(nameOne)

$.ajax({
    url: `http://chst.vip:1234/api/getdiscountproduct?productid=${productid}`
})
    .then(res => {
        let productName = res.result[0].productName
        let productPrice = res.result[0].productPrice
        let productFrom = res.result[0].productFrom
        let productTime = res.result[0].productTime
        let productTips = res.result[0].productTips
        let productInfo = res.result[0].productInfo
        let productImg = res.result[0].productImg

        let content = `
        <div class="title">
            <h4>${productName}</h4>
        </div>
        <div class="news">
            <span>${productFrom}|${productTime}</span>
            <span>${productTips}</span>
            <span>${productPrice}</span>
        </div>
        <div class="data">
            <span>${productInfo}</span>
        </div>
        <div class="pic">
            ${productImg}
        </div>`

        $("#content")[0].innerHTML = content
    })

$("#footer>.dengruSpan>.backTop").click(function () {
    $("html").animate({ scrollTop: 0 }, 1000)
})